package com.youngjun.user.api.admin;

import com.youngjun.common.mybatis.web.Response;
import com.youngjun.user.pojo.dto.DepartmentDTO;
import com.youngjun.user.pojo.dto.query.DepartmentQueryDTO;
import com.youngjun.user.pojo.vo.DepartmentVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(tags = "部门管理")
@FeignClient(
        name = "${ums.api.name:ums-service}",
        contextId = "departmentRestApi",
        url  = "${ums.api.url:http://127.0.0.1:8080}",
        path = "/department"
)
public interface IDepartmentRestApi {

    @ApiOperation(value="查询当前组织部门信息")
    @RequestMapping(method = RequestMethod.POST, path = "/query_list_by_current_organization")
    Response<List<DepartmentVO>> queryListByCurrentOrganization(@RequestBody DepartmentQueryDTO dto);

    @ApiOperation(value="根据组织id查询部门信息")
    @RequestMapping(method = RequestMethod.POST, path = "/query_list")
    Response<List<DepartmentVO>> queryList(@RequestBody DepartmentQueryDTO dto);

    @ApiOperation(value="根据当前组织创建部门信息")
    @RequestMapping(method = RequestMethod.POST, path = "/create_by_current_organization")
    Response<DepartmentVO> createByCurrentOrganization(@RequestBody DepartmentDTO dto);

    @ApiOperation(value="创建部门信息")
    @RequestMapping(method = RequestMethod.POST, path = "/create")
    Response<DepartmentVO> create(@RequestBody DepartmentDTO dto);

    @ApiOperation(value="根据当前组织修改部门信息")
    @RequestMapping(method = RequestMethod.PUT, path = "/modify_by_current_organization")
    Response<DepartmentVO> modifyByCurrentOrganization(@RequestBody DepartmentDTO dto);

    @ApiOperation(value="修改部门信息")
    @RequestMapping(method = RequestMethod.PUT, path = "/modify")
    Response<DepartmentVO> modify(@RequestBody DepartmentDTO dto);

    @ApiOperation(value="根据当前组织删除部门信息")
    @RequestMapping(value = "/delete_by_current_organization",method = RequestMethod.DELETE)
    Response<Void> deleteByCurrentOrganization(@RequestParam("id") Long id);

    @ApiOperation(value="删除部门信息")
    @RequestMapping(value = "/delete",method = RequestMethod.DELETE)
    Response<Void> delete(@RequestParam("id") Long id);

}